﻿SSVC.Utils.Page.IncludeFile("../styles/FeedToolbar.css", "css");

SSVC.Wrap.Dojo.Require([
    "dojo/_base/fx",
    "dojo/_base/lang",
    "dojo/dom-style",
    "dojo/mouse",
    "dojo/on",
    "dijit/_WidgetBase",
    "dijit/_TemplatedMixin"],
	 SSVC.Wrap.Dojo.Hitch(this,
		function(baseFx, lang, domStyle, mouse, on, _WidgetBase, _TemplatedMixin)
		{
			return SSVC.Wrap.Dojo.SetObject("SSVC.UI.mtButton", SSVC.Wrap.Dojo.Declare([_WidgetBase, _TemplatedMixin],
			{
				IsPressed: false,
				styleClassArray: null,

				constructor: function(buttonID, styleClassArrayPar)
				{
					this.id = buttonID;
					this.styleClassArray = styleClassArrayPar;
				},

				// Our template - important!
				templateString: "<span></span>",

				postCreate: function()
				{
					this.inherited(arguments);

					for (var i = 0; i < this.styleClassArray.length; i++)
						SSVC.Wrap.Dojo.AddClass(this.domNode, this.styleClassArray[i]);

					on(this.domNode, "click", lang.hitch(this, "OnClickInternal"));
				},

				SetPressedState: function(newState)
				{
					this.IsPressed = newState;

					if (this.IsPressed)
						SSVC.Wrap.Dojo.AddClass(this.domNode, "MarkupPressedButton");
					else
						SSVC.Wrap.Dojo.RemoveClass(this.domNode, "MarkupPressedButton");
				},

				OnClick: function(args) { },
				OnClickInternal: function()
				{
					this.OnClick(arguments);
				}
			}));
		}));
